package org.apogeescience.test;

import java.util.Date;

import org.apogeescience.annotation.Column;
import org.apogeescience.annotation.NamedQueries;
import org.apogeescience.annotation.NamedQuery;
import org.apogeescience.annotation.Parameter;
import org.apogeescience.annotation.Parameters;
import org.apogeescience.annotation.Table;
import org.apogeescience.annotation.enums.ComparisonType;
import org.apogeescience.annotation.enums.QueryType;

@Table(name="Users")
@NamedQueries({
	@NamedQuery(name = "testSelect", queryType=QueryType.Select, parameters=@Parameters({
		@Parameter(name="UserName", evaluate=ComparisonType.Equals, type=String.class)
	}), orderBy="userId desc"),
	@NamedQuery(name = "testInsert", queryType=QueryType.Insert, parameters=@Parameters({
		@Parameter(name="UserName", evaluate=ComparisonType.Equals, type=String.class)
	})),
	@NamedQuery(name = "testUpdate", queryType=QueryType.Update, parameters=@Parameters({
		@Parameter(name="UserName", evaluate=ComparisonType.Equals, type=String.class)
	})),
	@NamedQuery(name = "testDelete", queryType=QueryType.Insert, parameters=@Parameters({
		@Parameter(name="UserName", evaluate=ComparisonType.Equals, type=String.class)
	}))
})
public class User {

	private int userId;
	private String userName;
	private String password;
	private String enabled;
	private String accessLevel;
	private String firstName;
	private String lastName;
	private String emailAddress;
	private Date lastLogin;
	private Date createDate;
	
	public User() {

	}

	@Column(name="userId", type=Integer.class, nullable=false, precision=12, sequence="user_seq")
	public int getUserId() {
		return this.userId;
	}
	
	public void setUserId(int userId) {
		this.userId = userId;
	}
	
	@Column(name="UserName", nullable=false)
	public String getUserName() {
		return this.userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}
	
	@Column(name="Password", nullable=false)
	public String getPassword() {
		return this.password;
	}
	
	public void setPassword(String password) {
		this.password = password;
	}
	
	@Column(name = "CreateDate", type=Date.class, format="YYYY-MM-DD")
	public Date getCreateDate() {
		return this.createDate;	
	}
	
	public void setCreateDate(Date date) {
		this.createDate = date;
	}
	
	@Column(name="LastLogin", type=Date.class, format="YYYY-MM-DD")
	public Date getLastLogin() {
		return this.lastLogin;
	}
	
	public void setLastLogin(Date lastLogin) {
		this.lastLogin = lastLogin;
	}
	
	@Column(name="enabled")
	public String getEnabled() {
		return this.enabled;
	}
	
	public void setEnabled(String enabled) {
		this.enabled = enabled;
	}
	
	@Column(name="accessLevel")
	public String getAccessLevel() {
		return this.accessLevel;
	}
	
	public void setAccessLevel(String accessLevel) {
		this.accessLevel = accessLevel; 
	}
	
	@Column(name="firstName")
	public String getFirstName() {
		return this.firstName;
	}
	
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}
	
	@Column(name="lastName")
	public String getLastName() {
		return this.lastName;
	}
	
	public void setLastName(String lastName) {
		this.lastName = lastName;
	}
	
	@Column(name="emailAddress")
	public String getEmailAddress() {
		return this.emailAddress;
	}
	
	public void setEmailAddress(String emailAddress) {
		this.emailAddress = emailAddress;
	}
	
	public String toString() {
		return this.getUserName() + " " + this.getCreateDate();
	}

}
